package ui 
{
	import common.math.Vector2D;
	import com.dozen.mc.DUITile;
	import common.util.Vector2DUtil;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.filters.DropShadowFilter;
	import flash.geom.Point;
	import ui.data.MapInfo;
	
	/**
	 * ...
	 * @author Surui
	 */
	public class UIHouseLayer extends Sprite 
	{
		/** 外框投影效果 */
		private var m_overShadow:DropShadowFilter = new DropShadowFilter(0, 45, 0x0000FF, 1, 5, 5, 2); //透明
		public function UIHouseLayer() 
		{
			var tile:DUITile = new DUITile();
			MapInfo.self.unitWidht = tile.width / 2;
			MapInfo.self.unitHeight = tile.height / 2;
			MapInfo.self.xAxes = new Point( MapInfo.self.unitWidht, MapInfo.self.unitHeight );
			MapInfo.self.yAxes = new Point( -MapInfo.self.unitWidht, MapInfo.self.unitHeight );
            //drawMap(5, 10);
		}
		public function drawMap(row:int,cos:int):void
		{
			for (var r:int=0; r<row; r++)
			{
				for (var c:int=0; c<cos; c++)
				{
					var tile:DUITile = new DUITile();
					tile.mouseEnabled = false;
					this.addChild(tile)
					tile.x = (c - r) * MapInfo.self.unitWidht;
					tile.y = (c + r) * MapInfo.self.unitHeight;	
					trace(tile.x, tile.y);
					tile.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
					tile.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
				}
			}
		}
		
		private function onMouseOver( event:MouseEvent ):void
		{
			event.target.filters = [m_overShadow];
		}
		private function onMouseOut( event:MouseEvent ):void
		{
			event.target.filters = [];
		}
	}

}